<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\BaseController;
use think\Request;
use app\model\Query as QueryModel;
class Query extends BaseController
{
    public function index()
    {
        $data=QueryModel::with('parent')->select();
        $top=QueryModel::where('pid',0)->select();
        return $this->success(compact('data','top'));
    }

    public function create()
    {
        return $this->success(QueryModel::create(request()->param()));
    }


    public function update($id)
    {

        return $this->success(QueryModel::where('id',$id)->update(request()->param()));
    }


    public function delete($id)
    {
        return $this->success(QueryModel::where('id',$id)->delete());
    }
}
